﻿<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeBehind="grid_excel.aspx.cs"
    Inherits="ExtAspNet.Examples.data.grid_excel" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title><link href="../css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <ext:PageManager ID="PageManager1" runat="server" />
    Grid Control in ExtAspNet：
    <ext:Grid ID="Grid1" Title="表格" ShowBorder="true" ShowHeader="true" Width="900px"
        AutoHeight="true" runat="server" EnableCheckBoxSelect="true" DataKeyNames="Id,Year,MyText"
        EnableRowNumber="True">
        <Columns>
            <ext:BoundField DataTooltipField="MyText" Width="200px" DataField="MyText" DataFormatString="{0}"
                HeaderText="MyText" ExpandUnusedSpace="True" />
            <ext:BoundField ColumnId="column1" Width="100px" DataField="MyValue" HeaderText="MyValue" />
            <ext:BoundField Width="60px" DataField="Year" HeaderText="Year" />
            <ext:CheckBoxField DataTooltipField="MyText" Width="60px" RenderAsStaticField="true"
                DataField="MyCheckBox" HeaderText="CheckBox" />
            <ext:HyperLinkField DataTooltipField="MyText" Width="200px" HeaderText="HyperLink"
                DataTextField="MyText" DataTextFormatString="{0}" DataNavigateUrlFields="Id,MyValue"
                DataNavigateUrlFormatString="http://www.baidu.com/search?q=ExtAspNet+{0}+{1}" Target="_blank"
                NavigateUrl="~/alert.aspx" Text="HyperLink" />
            <ext:TemplateField HeaderText="TemplateField">
                <ItemTemplate>
                    <%# GetMyValue(DataBinder.Eval(Container.DataItem, "[MyValue]")) %>
                </ItemTemplate>
            </ext:TemplateField>
            <ext:ImageField DataTooltipField="MyText" Width="60px" DataImageUrlField="MyValue"
                DataImageUrlFormatString="~/images/16/{0}.png" HeaderText="Image"></ext:ImageField>
        </Columns>
    </ext:Grid>
    <br />
    <ext:Button ID="Button1" EnableAjax="false" DisableControlBeforePostBack="false"
        runat="server" Text="导出ExtAspNet控件Grid到Excel文件" OnClick="Button1_Click">
    </ext:Button>
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    GridView Control in Asp.net：
    <asp:GridView ID="GridView1" Width="900px" DataKeyNames="Id" AutoGenerateColumns="False"
        runat="server">
        <Columns>
            <asp:BoundField DataField="MyText" HeaderText="MyText" />
            <asp:BoundField DataField="MyValue" HeaderText="MyValue" />
            <asp:BoundField DataField="Year" HeaderText="Year" />
            <asp:CheckBoxField DataField="MyCheckBox" HeaderText="CheckBox" />
            <asp:HyperLinkField HeaderText="HyperLink" DataTextField="MyText" DataTextFormatString="{0}"
                DataNavigateUrlFields="Id,MyValue" DataNavigateUrlFormatString="http://www.baidu.com/search?q=ExtAspNet+{0}+{1}"
                Target="_blank" NavigateUrl="~/alert.aspx" Text="HyperLinkField" />
            <asp:TemplateField HeaderText="TemplateField">
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# GetMyValue(Eval("MyValue")) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:ImageField DataImageUrlField="MyValue" DataImageUrlFormatString="~/images/16/{0}.png"
                HeaderText="Image">
            </asp:ImageField>
        </Columns>
    </asp:GridView>
    <br />
    <br />
    <ext:Button ID="Button2" EnableAjax="false" DisableControlBeforePostBack="false"
        runat="server" Text="导出AspNet控件GridView到Excel文件" OnClick="Button2_Click">
    </ext:Button>
    <br />
    <br />
    <br />
    </form>
</body>
</html>
